
Map is matrix of 112x64 blocks

Each file is a block of 64x64 tiles

Map sizes are width=112x64=7168 height=64x64=4096

XBlock = Int(XPos/64)
YBlock = Int(YPos/64)
Block Number = (XBlock * 64) + YBlock

Blocks are loaded from top to bottom than left to right.
Cells are loaded from blocks top to bottom then left to right.

Every files in facetX.uop is a block, execpt for the first file that contains map size.

In a block file there are 3 type of elements:

- LandTile
- Delimiter
- StaticTile

Header for all elements:

BYTE Unk1
BYTE Type1
BYTE Type2

if(Type1!=0) elem is a Delimiter, Type1 is # boundary blocks, Type 2 is Relative Direction of first block
if(Type1==0) && (Type2!=0) elem is a StaticTile, Type2 is # static blocks
else elem is a LandTile

The first element is always a LandTile, with WORD (Type1,Type2) set to current Block ID.


Then for each types continues as it follows:


for LandTile:

SBYTE Z (-127,127)
WORD New Graphic (8==Snow 5==Sea 1==Grass ...)
WORD Legacy Graphic flipped



for Delimiters:
(it appears only after cells placed on the boundaries of the blocks if they confine with other map blocks)

SBYTE Last Cell Z
WORD Last Cell New Graphic

if( # boundary blocks>1)
  for each boundary block
   BYTE Unkk1
   BYTE 0
   BYTE Relative Direction
   SBYTE Last Cell Z
   WORD Last Cell type of terrain
  end for
endif

Relative Direction is one of this values:

1     2      7
  ----------
  |        |
  |   Map  |
0 |  Block | 3
  |        |
  |        |
  ----------
6     5      4




for StaticTile:

WORD Graphic
BYTES(2) UnkS
SBYTE Z
BYTE UnkS2
if( # static blocks>1)
  for each static block
   BYTES(3) 0
   WORD Graphic
   BYTES(2) Unk (seems always 0)
   SBYTE Z
   WORD Color ( Last byte overlaps next elem byte)
  end for
endif

File EOF is 0x00 0x00 0x00 


-------------------------------------


KR Facet Diagram:

Each file starts with:
- BYTE Facet
- WORD File ID
- LandTile

Each element has a Header except the first one
-BYTE Type1
-BYTE Type2

-------------------------

if ( T1 == 0 && T2 == 0 )
Element is LANDTILE:

-SBYTE Z
-WORD KR Graphic
-BYTE Type3 = koksi knows what is it.
-WORD ML Graphic = Reversed

Tile : T1  T2  Z   GK  GK T3 GL GL

-------------------------

if ( T1 == 1 || T1 > 1 )
Element is DELIMITER, T1 is number of Delimiters:

IF( T1 == 1 )
- BYTE Direction == Type2 ( same byte, not same value )
- SBYTE Z
- WORD Graphic
- BYTE Unk ( maybe 3 bytes graphic )

IF( T1 > 1 )
- BYTE == 0 ( Type1 substitutes )
- BYTE Direction
- SBYTE Z
- WORD Graphic
- BYTE Unk ( maybe 3 bytes graphic )

Delimiter:  T1 D  Z   G1 G2 U2

-------------------------

if ( T1 == 0 && T2 != 0 )
Element is STATIC, T2 is number of statics:

IF ( T2 == 1 )
- WORD Graphic
- 2 BYTES == 0
- SBYTE Z
- WORD Color

IF ( T2 > 1 )
- 2 BYTES == 0 ( header subtitute )
- WORD Graphic
- 2 BYTES == 0
- SBYTE Z
- WORD Color

Static : T1 T2 G1 G2 U  U  Z  C1 C2

------------------------

EXAMPLE :

Facet : 1 

T1  T2  Z   GK  GK T3 GL GL 
FF  14  25  9B  0  0  71  0 

T1 D  Z   G1 U  U2
3  0  25  2  0  0 
0  1  25  2  0  0 
0  2  25  2  0  0 

T1 T2 G1 G2 U  U  Z  C1 C2
0  3  8  5  0  0  39  0  0 
0  0  27  2  0  0  25  0  0 
0  0  24  4  0  0  3A  0  0  